package com.econ.powercloud.ems.common.enums;

/**
 * @Author : zjf
 * @Description : 故障来源枚举
 * @Date : 2022/5/9 14:06
 * @Modified by : zjf
 */
public enum EventSourceType implements EnumMethod{

    PLATFORM_ANALYSIS(1, "平台解析"),
    EVENT_CHANNEL(2, "事件通道"),
    YX(3,"遥信");

    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    EventSourceType(int code, String desc){
        this.code=code;
        this.desc=desc;
    }

    public static EventSourceType fromCode(int code){
        for(EventSourceType type: EventSourceType.values()){
            if(type.getCode() == code){
                return type;
            }
        }
        return null;
    }

    public static String getDescFromCode(int code){
        for(EventSourceType type: EventSourceType.values()){
            if(type.getCode() == code){
                return type.getDesc();
            }
        }
        return null;
    }

}
